const User = require('../model/user.model')
class UserService {
    async createUser(username,password) {
        //TODO: implement
        const res = await User.create({username,password})
        return res.dataValues
    }
    async getUser(username) {
        //TODO: implement
        const res = await User.findOne({where:{username}})
        return res
    }
    async updateUserPassword(id,password,is_admin) {
        //TODO: implement
        const res = await User.update({password,is_admin},{where:{id}})
        return res[0] > 0 ? true : false
    }
}
module.exports = new UserService();